{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 1,
   "metadata": {
    "collapsed": true
   },
   "outputs": [],
   "source": [
    "import numpy as np\n",
    "import pandas as pd\n",
    "import matplotlib.pyplot as plt\n",
    "import os\n",
    "from sklearn import metrics\n",
    "\n",
    "from sklearn import preprocessing\n",
    "\n",
    "os.chdir(\"C:/Users/Ma/Desktop/document/企业经营退出风险预测/analysis\")\n",
    "\n",
    "data_train = pd.read_csv('evaluation_public.csv',encoding='gb2312')\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>EID</th>\n",
       "      <th>FORTARGET</th>\n",
       "      <th>PROB</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>350</td>\n",
       "      <td>0</td>\n",
       "      <td>0.101688</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>562</td>\n",
       "      <td>0</td>\n",
       "      <td>0.171744</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>632</td>\n",
       "      <td>0</td>\n",
       "      <td>0.124908</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>750</td>\n",
       "      <td>0</td>\n",
       "      <td>0.230737</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>823</td>\n",
       "      <td>0</td>\n",
       "      <td>0.335911</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "   EID  FORTARGET      PROB\n",
       "0  350          0  0.101688\n",
       "1  562          0  0.171744\n",
       "2  632          0  0.124908\n",
       "3  750          0  0.230737\n",
       "4  823          0  0.335911"
      ]
     },
     "execution_count": 4,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "data_train.head()"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# 网格搜索法调整参数"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {
    "collapsed": true
   },
   "outputs": [],
   "source": [
    "from sklearn.ensemble import RandomForestClassifier,GradientBoostingClassifier\n",
    "from xgboost.sklearn import XGBClassifier\n",
    "# from sklearn.metrics import f1_score\n",
    "from sklearn.cross_validation import train_test_split\n",
    "from sklearn.grid_search import GridSearchCV\n",
    "from sklearn.preprocessing import PolynomialFeatures\n",
    "\n",
    "#---------------------------------------------------------读取数据集---------------------------------------------------#\n",
    "data_train = pd.read_csv('data_train.csv',encoding='gb2312')\n",
    "targets = data_train['TARGET']\n",
    "train_data = data_train.drop(labels=['TARGET'],axis=1)\n",
    "# ------------------------------------------------------- 划分样本集----------------------------------------------------#\n",
    "train_x,test_x,train_y,test_y = train_test_split(train_data,targets,test_size=0.5,random_state=66)\n",
    "#--------------------------------------------------------设置参数&交叉验证----------------------------------------------#\n",
    "# -------------------------------------------------------XGBoost--------------------------------------------------------#\n",
    "# param = {'n_estimators':[i for i in range(800,1400,50)],\n",
    "        # 'learning_rate':[i/100 for i in range(1,20,2)]}\n",
    "# grid_search = GridSearchCV(XGBClassifier(scale_pos_weight=4,nthread=-1,seed=6,max_depth=3,min_child_weight=6,\n",
    "                        # gamma=0,subsample=0.9,colsample_bytree=0.9,reg_alpha=8),\n",
    "                    # cv=5,param_grid=param,n_jobs=20,scoring='roc_auc')\n",
    "# grid_search.fit(train_x,train_y)\n",
    "\n",
    "#-------------------------------------------------------RandmForest-----------------------------------------------------#\n",
    "# print(\"randmforest results:\\n\")\n",
    "# param = {'oob_score':[True,False]}\n",
    "# grid_search = GridSearchCV(RandomForestClassifier(n_estimators=1000,max_depth=19,criterion='entropy',\n",
    "#                                                   max_features='sqrt',min_samples_split=15),\n",
    "#                     cv=5,param_grid=param,n_jobs=-1,scoring='roc_auc')\n",
    "# grid_search.fit(train_x,train_y)\n",
    "\n",
    "#----------------------------------------------------------GBDT---------------------------------------------------------#\n",
    "print(\"GradientBoostingClassifier results:\\n\")\n",
    "param = {'n_estimators':[i for i in range(400,900,100)],\n",
    "        'learning_rate':[i/100 for i in range(5,15,2)]}\n",
    "grid_search = GridSearchCV(GradientBoostingClassifier(n_estimators=600,loss = 'exponential',max_depth=4,min_samples_split=10,\n",
    "                        min_weight_fraction_leaf=0.01,subsample=0.9,learning_rate=0.07),\n",
    "                    cv=5,param_grid=param,n_jobs=-1,scoring='roc_auc')\n",
    "grid_search.fit(train_x,train_y)\n",
    "\n",
    "\n",
    "# ------------------------------------------------最佳参数在验证集上的结果----------------------------------------------#\n",
    "pre_y = grid_search.predict_proba(test_x)[:,1]\n",
    "pre_y_categ = grid_search.predict(test_x)\n",
    "# ----------------------------------------------------计算auc,f1-score--------------------------------------------------#\n",
    "fpr, tpr, thresholds = metrics.roc_curve(test_y, pre_y)\n",
    "auc=metrics.auc(fpr, tpr)\n",
    "f1 = metrics.f1_score(test_y,pre_y_categ)\n",
    "print(\"AUC得分为：\")\n",
    "print(auc)\n",
    "print('f1-score为：')\n",
    "print(f1)\n",
    "#-----------------------------------------------------打印结果-----------------------------------------------------------#\n",
    "print(\"Best parameters set found on development set:\")\n",
    "print()\n",
    "print(grid_search.best_params_)\n",
    "print(\"best_estimator_\")\n",
    "print(grid_search.best_estimator_)\n",
    "print('grid_scores_:')\n",
    "print(grid_search.grid_scores_)\n",
    "print('best_score_')\n",
    "print(grid_search.best_score_)\n",
    "#----------------------------------------------------------------------------------------------------------#"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# XGBoost"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 1,
   "metadata": {
    "collapsed": true
   },
   "outputs": [],
   "source": [
    "from xgboost.sklearn import XGBClassifier\n",
    "# from sklearn.metrics import f1_score\n",
    "from sklearn.cross_validation import train_test_split\n",
    "from sklearn.preprocessing import PolynomialFeatures\n",
    "\n",
    "targets = data_train['TARGET']\n",
    "train_data = data_train.drop(labels=['EID','TARGET'],axis=1)\n",
    "# poly = PolynomialFeatures(2)\n",
    "# train_data = poly.fit_transform(train_data)\n",
    "# ----------------------------------------划分样本集----------------------------------#\n",
    "train_x,test_x,train_y,test_y = train_test_split(train_data,targets,test_size=0.5,random_state=66)\n",
    "\n",
    "# ----------------------------------------设置参数------------------------------------#\n",
    "xgb = XGBClassifier(n_estimators=200,max_depth=5,nthread=3,scale_pos_weight=4,learning_rate=0.07)\n",
    "# 训练\n",
    "xgb.fit(train_x, train_y)\n",
    "# 预测\n",
    "pre_y = xgb.predict_proba(test_x)[:,1]\n",
    "pre_y_categ = xgb.predict(test_x)\n",
    "# 计算auc\n",
    "fpr, tpr, thresholds = metrics.roc_curve(test_y, pre_y)\n",
    "auc=metrics.auc(fpr, tpr)\n",
    "f1 = metrics.f1_score(test_y,pre_y_categ)\n",
    "print(\"AUC得分为：\")\n",
    "print(auc)\n",
    "print('f1-score为：')\n",
    "print(f1)\n",
    "# 画出特征重要性图\n",
    "features = list(train_data.columns)\n",
    "feature_important = xgb.feature_importances_\n",
    "plt.figure(figsize=(16,4))\n",
    "plt.bar(np.arange(len(features)),feature_important)\n",
    "plt.xticks(np.arange(len(features)),features,fontsize=10)\n",
    "plt.show()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 23,
   "metadata": {
    "collapsed": true
   },
   "outputs": [],
   "source": [
    "from xgboost.sklearn import XGBClassifier\n",
    "?XGBClassifier()\n",
    "# data_train.head()"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# GBDT"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 14,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "AUC得分为：\n",
      "0.676445108368\n",
      "f1-score为：\n",
      "0.0287847929396\n"
     ]
    },
    {
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Y/IY8YiO+1HqVr0KpW7VF4HBy2kw8/aymSXdql/Ewm7VE9FjnQUbL8ni\n9rv7vvgbGSuGGt7fCuAZcGTRLPhaugXAFwCeq3ZM2p5Yd/+w2qL0PpmLVu+DlRwpSBUREZFu8K+7\nv2lmswBuQ2k26goAy8ET1UmwBDOejfoSotmo4b6mkMLLuwCPgPsbk27Vr5jZZeD4kWl3nzWz98Bx\nFT9Gwe6CjJ80Lsfy0SxloX1gd+UhcAbuCQBXnUspqTRFXhcypAAq9xUREZGuYQ3ORq04tu6simm8\nV9fIUhaqUtLOUKvJlLQ3BakiIiLSVazGbNS8TlZN3aq7Rpb9rXntiRWRdApSRUREpCske0ZDADEK\nYB0YSOxw95PR7Zo5+kKBSYfJMh6lXUe9iHQLBakiIiIiGSkw6Q5ZykJVSirSPApSRUREREREpG2c\nV/QCRERERERERBIKUkVERERERKRtKEgVERERERGRtqEgVURERERERNqGglQRERERERFpGwpSRURE\nREREpG38D7U9jD4SbLcZAAAAAElFTkSuQmCC\n",
      "text/plain": [
       "<matplotlib.figure.Figure at 0x24eba1b93c8>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "data_train = pd.read_csv('data_train.csv',encoding='gb2312')\n",
    "from sklearn.ensemble import GradientBoostingClassifier\n",
    "# from sklearn.metrics import f1_score\n",
    "from sklearn.cross_validation import train_test_split\n",
    "\n",
    "targets = data_train['TARGET']\n",
    "train_data = data_train.drop(labels=['EID','TARGET'],axis=1)\n",
    "#  划分样本集\n",
    "train_x,test_x,train_y,test_y = train_test_split(train_data,targets,test_size=0.5,random_state=66)\n",
    "# 设置参数\n",
    "gbdt = GradientBoostingClassifier(loss='exponential',n_estimators=20,max_depth=7)\n",
    "# 训练\n",
    "gbdt.fit(train_x, train_y)\n",
    "# 预测\n",
    "pre_y = gbdt.predict_proba(test_x)[:,1]\n",
    "pre_y_categ = gbdt.predict(test_x)\n",
    "# 计算auc\n",
    "fpr, tpr, thresholds = metrics.roc_curve(test_y, pre_y)\n",
    "auc=metrics.auc(fpr, tpr)\n",
    "f1 = metrics.f1_score(test_y,pre_y_categ)\n",
    "print(\"AUC得分为：\")\n",
    "print(auc)\n",
    "print('f1-score为：')\n",
    "print(f1)\n",
    "# 画出特征重要性图\n",
    "features = list(train_data.columns)\n",
    "feature_important = gbdt.feature_importances_\n",
    "plt.figure(figsize=(16,4))\n",
    "plt.bar(np.arange(len(features)),feature_important)\n",
    "plt.xticks(np.arange(len(features)),features,fontsize=9,rotation=15)\n",
    "plt.show()"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# 随机深林、KNN、朴素贝叶斯、逻辑回归"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 38,
   "metadata": {
    "collapsed": true
   },
   "outputs": [],
   "source": [
    "from sklearn import svm\n",
    "from sklearn import metrics\n",
    "from sklearn.externals import joblib\n",
    "from sklearn.ensemble import RandomForestClassifier\n",
    "from sklearn.linear_model import RidgeClassifier\n",
    "from sklearn.neighbors import KNeighborsClassifier\n",
    "from sklearn.naive_bayes import BernoulliNB,MultinomialNB\n",
    "from sklearn.linear_model import LogisticRegression\n",
    "\n",
    "targets = data_train['TARGET']\n",
    "train_data = data_train.drop(labels=['EID','TARGET'],axis=1)\n",
    "#  划分样本集\n",
    "train_x,test_x,train_y,test_y = train_test_split(train_data,targets,test_size=0.25,random_state=66)\n",
    "\n",
    "def benchmark(clf):\n",
    "    print('_' * 80)\n",
    "    print(\"Training: \")\n",
    "    clf.fit(train_x,train_y)\n",
    "    # print(\"train time is %f\"% train_time)\n",
    "\n",
    "    # 预测\n",
    "    pre_y = clf.predict_proba(test_x)[:,1]\n",
    "    pre_y_categ = clf.predict(test_x)\n",
    "    # 计算auc\n",
    "    fpr, tpr, thresholds = metrics.roc_curve(test_y, pre_y)\n",
    "    auc=metrics.auc(fpr, tpr)\n",
    "    f1 = metrics.f1_score(test_y,pre_y_categ)\n",
    "\n",
    "    clf_descr = str(clf).split('(')[0]\n",
    "    return auc, f1\n",
    "\n",
    "results = []\n",
    "clf_names = []\n",
    "\n",
    "for clf,name in ((KNeighborsClassifier(n_neighbors=3),\"KNN\"),\n",
    "                (RandomForestClassifier(n_estimators=200,max_features='log2'),\"RandomForest\"),\n",
    "                (BernoulliNB(alpha=0.01),\"BernoulliNB\"),\n",
    "                (LogisticRegression(penalty='l2',class_weight ={'1':4}),'Logistic')):\n",
    "    results.append(benchmark(clf))\n",
    "    clf_names.append(name)\n",
    "    \n",
    "results = [[x[i] for x in results] for i in range(2)]\n",
    "auc, f1 = results\n",
    "\n",
    "indices = np.arange(len(auc))\n",
    "\n",
    "plt.figure(figsize=(12,8))\n",
    "plt.title('模型对比')\n",
    "plt.barh(indices,auc,0.2,label='auc',color='r')\n",
    "plt.barh(indices+0.3,f1,0.2,label='f1',color='g')\n",
    "\n",
    "plt.yticks(())\n",
    "plt.legend(loc='best')\n",
    "for i,c in zip(indices, clf_names):\n",
    "    plt.text(-0.3,i,c,fontsize=12)\n",
    "plt.show()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 29,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>EID</th>\n",
       "      <th>RGYEAR</th>\n",
       "      <th>HY</th>\n",
       "      <th>ZCZB</th>\n",
       "      <th>ETYPE</th>\n",
       "      <th>MPNUM</th>\n",
       "      <th>INUM</th>\n",
       "      <th>FINZB</th>\n",
       "      <th>FSTINUM</th>\n",
       "      <th>TZINUM</th>\n",
       "      <th>...</th>\n",
       "      <th>inv_ZP03</th>\n",
       "      <th>inv_recruit_tot</th>\n",
       "      <th>inv_re_month</th>\n",
       "      <th>inv_ZB_pro</th>\n",
       "      <th>inv_dificit</th>\n",
       "      <th>inv_end_if</th>\n",
       "      <th>inv_endyear_impor</th>\n",
       "      <th>inv_dif_wei</th>\n",
       "      <th>invest_if</th>\n",
       "      <th>TARGET</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>32741</td>\n",
       "      <td>2000</td>\n",
       "      <td>87</td>\n",
       "      <td>100.0</td>\n",
       "      <td>7</td>\n",
       "      <td>1.0</td>\n",
       "      <td>3.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>2.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>...</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>-20.0</td>\n",
       "      <td>250.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.168155</td>\n",
       "      <td>0.0</td>\n",
       "      <td>1</td>\n",
       "      <td>0.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>294220</td>\n",
       "      <td>2003</td>\n",
       "      <td>51</td>\n",
       "      <td>50.0</td>\n",
       "      <td>7</td>\n",
       "      <td>0.0</td>\n",
       "      <td>3.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>...</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0</td>\n",
       "      <td>0.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>10526</td>\n",
       "      <td>2013</td>\n",
       "      <td>75</td>\n",
       "      <td>100.0</td>\n",
       "      <td>7</td>\n",
       "      <td>1.0</td>\n",
       "      <td>2.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>1.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>...</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0</td>\n",
       "      <td>0.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>237382</td>\n",
       "      <td>2014</td>\n",
       "      <td>75</td>\n",
       "      <td>9900.0</td>\n",
       "      <td>7</td>\n",
       "      <td>3.0</td>\n",
       "      <td>4.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>2.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>...</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0</td>\n",
       "      <td>1.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>473535</td>\n",
       "      <td>2008</td>\n",
       "      <td>75</td>\n",
       "      <td>50.0</td>\n",
       "      <td>7</td>\n",
       "      <td>3.0</td>\n",
       "      <td>5.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>1.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>...</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0</td>\n",
       "      <td>1.0</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "<p>5 rows × 197 columns</p>\n",
       "</div>"
      ],
      "text/plain": [
       "      EID  RGYEAR  HY    ZCZB  ETYPE  MPNUM  INUM  FINZB  FSTINUM  TZINUM  \\\n",
       "0   32741    2000  87   100.0      7    1.0   3.0    0.0      2.0     0.0   \n",
       "1  294220    2003  51    50.0      7    0.0   3.0    0.0      0.0     0.0   \n",
       "2   10526    2013  75   100.0      7    1.0   2.0    0.0      1.0     0.0   \n",
       "3  237382    2014  75  9900.0      7    3.0   4.0    0.0      2.0     0.0   \n",
       "4  473535    2008  75    50.0      7    3.0   5.0    0.0      1.0     0.0   \n",
       "\n",
       "    ...    inv_ZP03  inv_recruit_tot  inv_re_month  inv_ZB_pro  inv_dificit  \\\n",
       "0   ...         0.0              0.0         -20.0       250.0          0.0   \n",
       "1   ...         0.0              0.0           0.0         0.0          0.0   \n",
       "2   ...         0.0              0.0           0.0         0.0          0.0   \n",
       "3   ...         0.0              0.0           0.0         0.0          0.0   \n",
       "4   ...         0.0              0.0           0.0         0.0          0.0   \n",
       "\n",
       "   inv_end_if  inv_endyear_impor  inv_dif_wei  invest_if  TARGET  \n",
       "0         0.0           0.168155          0.0          1     0.0  \n",
       "1         0.0           0.000000          0.0          0     0.0  \n",
       "2         0.0           0.000000          0.0          0     0.0  \n",
       "3         0.0           0.000000          0.0          0     1.0  \n",
       "4         0.0           0.000000          0.0          0     1.0  \n",
       "\n",
       "[5 rows x 197 columns]"
      ]
     },
     "execution_count": 29,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "data_train.head()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 17,
   "metadata": {
    "collapsed": true
   },
   "outputs": [],
   "source": [
    "?GradientBoostingClassifier()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {
    "collapsed": true
   },
   "outputs": [],
   "source": []
  },
  {
   "cell_type": "markdown",
   "metadata": {
    "collapsed": true
   },
   "source": [
    "# 深度深林"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Slicing Sequence...\n",
      "Training MGS Random Forests...\n"
     ]
    }
   ],
   "source": [
    "import numpy as np\n",
    "import pandas as pd\n",
    "import matplotlib.pyplot as plt\n",
    "import os\n",
    "from sklearn import metrics\n",
    "\n",
    "from sklearn import preprocessing\n",
    "\n",
    "os.chdir(\"C:/Users/Ma/Desktop/document/企业经营退出风险预测/analysis\")\n",
    "data_train = pd.read_csv('data_train.csv',encoding='gb2312')\n",
    "\n",
    "from sklearn.ensemble import RandomForestClassifier\n",
    "# from sklearn.metrics import f1_score\n",
    "from sklearn.cross_validation import train_test_split\n",
    "from GCForest import gcForest\n",
    "\n",
    "targets = data_train['TARGET']\n",
    "train_data = data_train.drop(labels=['TARGET'],axis=1)\n",
    "train_data = np.array(train_data)\n",
    "# = PolynomialFeatures(2)\n",
    "#train_data = poly.fit_transform(train_data)\n",
    "\n",
    "#  划分样本集\n",
    "train_x,test_x,train_y,test_y = train_test_split(train_data,targets,test_size=0.5,random_state=66)\n",
    "\n",
    "gcf = gcForest(shape_1X=203, window=2, tolerance=0.0)\n",
    "gcf.fit(train_x,train_y)\n",
    "# 预测\n",
    "pre_y = gcf.predict_proba(test_x)[:,1]\n",
    "pre_y_categ = gcf.predict(test_x)\n",
    "# 计算auc\n",
    "fpr, tpr, thresholds = metrics.roc_curve(test_y, pre_y)\n",
    "auc=metrics.auc(fpr, tpr)\n",
    "f1 = metrics.f1_score(test_y,pre_y_categ)\n",
    "print(\"AUC得分为：\")\n",
    "print(auc)\n",
    "print('f1-score为：')\n",
    "print(f1)\n",
    "# 画出特征重要性图\n",
    "features = list(train_data.columns)\n",
    "feature_important = gcf.feature_importances_\n",
    "plt.figure(figsize=(16,4))\n",
    "plt.bar(np.arange(len(features)),feature_important)\n",
    "plt.xticks(np.arange(len(features)),features,fontsize=10,rotation=15)\n",
    "plt.show()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "metadata": {
    "collapsed": true
   },
   "outputs": [],
   "source": [
    "from GCForest import gcForest\n",
    "?gcForest()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {
    "collapsed": true
   },
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.6.0"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 2
}
